package org.dtrd.modules.faq.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.faq.entity.dto.FaqDetail;

import java.util.Date;


/**
 * <p>
 * 知识问答
 * </p>
 *
 * @author QR
 * @since 2021-12-06
 */
@Getter
@Setter
@TableName("dtrd_ext_ems_yw_faqs")
public class DtrdExtEmsYwFaqs {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    /**
     * 常见问题
     */
    @TableField("faq_question")
    private String faqQuestion;

    /**
     * 问题答案
     */
    @TableField("faq_answer")
    private String faqAnswer;

    /**
     * 所属分类
     */
    @TableField("faq_categoryId")
    private Integer faqCategoryid;

    /**
     * 创建时间
     */
    @TableField("faq_create_time")
    private Date faqCreateTime;

    /**
     * 常见问题标签
     */
    @TableField("faq_tips")
    private String faqTips;

    /**
     * 常见问题创建人
     */
    @TableField("faq_creater")
    private String faqCreater;

    /**
     * 最后修改人
     */
    @TableField("faq_editor")
    private String faqEditor;

    /**
     * 最后修改时间
     */
    @TableField("faq_edit_time")
    private Date faqEditTime;

    /**
     * 删除时间
     */
    @TableField("faq_del_time")
    private Date faqDelTime;

    /**
     * 删除人
     */
    @TableField("faq_deleter")
    private String faqDeleter;

    /**
     * 常见问题URL
     */
    @TableField("faq_url")
    private String faqUrl;

    @TableField("faq_thumb")
    private String faqThumb;

    /**
     * 浏览量
     */
    @TableField("faq_views")
    private Integer faqViews;

    public DtrdExtEmsYwFaqs init() {
        isDel = 0;
        faqCreateTime = new Date();
        return this;
    }

    public DtrdExtEmsYwFaqs parseFromDto(FaqDetail dto) {
        dataId = dto.getDataId();
        faqQuestion = dto.getFaqQuestion();
        faqAnswer = dto.getFaqAnswer();
        faqCategoryid = dto.getFaqCategoryid();
        faqTips = dto.getFaqTips();
        faqUrl = dto.getFaqUrl();
        faqThumb = dto.getFaqThumb();
        faqViews = dto.getFaqViews();
        return this;
    }


}
